<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--1.添加视口标签 快捷方式：meta:vp -->
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <!--2.设置网页渲染模式  快捷方式：meta:compat  -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <!--3.把bootstrap 核心样式（压缩版）引入-->
    <link rel="stylesheet" href="/static/css/bootstrap.min.css"/>
    <!--6.针对于IE9 以下浏览器做兼容性处理 快捷方式：cc:ie -->
    <!--[if lt IE9 ]>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
    <title>文件上传</title>
    <style type="text/css">
        {#        #id_username {#}
        {#            width: auto;#}
        {#            height: auto;#}
        {#        }#}
        {##}
        {#        td {#}
        {#            height: 30px;#}
        {##}
        {#        }#}
        {##}
        {#        label {#}
        {#            display: block;#}
        {#            text-align: center;#}
        {#        }#}
    </style>
</head>
<body style="background-color: #5cb85c">
<div class="text-right ">
    {% if request.user.is_authenticated %}
        <span>用户名:<span id="user_name">{{ request.user }}</span>  已登录</span><span style="color: #5cb85c">  </span>
    {% else %}
        <span style="color: red">登录/注册 /<a href="/accounts/logout">注销</a></span>
    {% endif %}
    <span style="color: red"><a href="/accounts/logout" style="color: red">注销</a></span>
</div>
<div class="text-center">
    <h1 style="text-align: center;">本地上传代码文件</h1>
    <form method="post" enctype="multipart/form-data">
        <label class="">{{ uf.as_p }}</label>
{#        <br>#}
        <label>服务类型:
            <select name="service" class="btn btn-primary">
                <!--<option selected="selected">请选择</option>-->
                {% for i in data1 %}
                    <option>{{ i.service_name }}</option>
                {% endfor %}
            </select>
        </label><br>
        <label><input class="btn btn-primary" type="submit" style="" value="点击开始上传"/></label>
    </form>
    <h1 style="color: red;">{{ put }}</h1>
    <div style="height: 50px"></div>
    <h1 class="text-center">git拉取代码文件</h1>
    <form method="get" enctype="multipart/form-data">
        <label>用户名：<input class="user" type="text" name="user"></label>
        <label><input class="" type="radio" name="sex" value="git" checked>git
        </label>
        <label>git地址：<input type="text" name="address"></label>
        <label>服务类型:
            <select class="btn btn-primary" name="service">
                <!--<option selected="selected">请选择</option>-->
                {% for i in data1 %}
                    <option>{{ i.service_name }}</option>
                {% endfor %}
            </select>
        </label><br>
        <label><input class="btn btn-primary" type="submit" style="" value="点击开始拉取代码文件"/></label>
    </form>
    <h1 style="color: red;">{{ get }}</h1>
    <div style="height: 50px"></div>
    <h1 class="text-center">svn拉取代码文件</h1>
    <form method="get" enctype="multipart/form-data">
        <label>用户名：<input class="user" type="text" name="user"></label>
        <label>
            <input type="radio" name="sex" value="svn" checked>svn</label>
        <label>svn地址：<input class="" type="text" name="address"></label>
        <label>svn用户：<input type="text" name="svnuser"></label>
        <label>svn密码：<input type="password" name="svnpass"></label>
        <label>服务类型:
            <select class="btn btn-primary" name="service">
                <!--<option selected="selected">请选择</option>-->
                {% for i in data1 %}
                    <option>{{ i.service_name }}</option>
                {% endfor %}
            </select>
        </label><br>
        <label><input class="btn btn-primary" type="submit" style="" value="点击开始拉取代码文件"/></label>
    </form>
    <h1 style="color: red;">{{ get1 }}</h1>

    <h1 class="text-center"><a href="/admin/app01/user/" target="_blank">历史上传记录</a></h1>
    <table class="table table-bordered table-condensed">
        <tr>
            <td>id</td>
            <td>上传者</td>
            <td>文件名</td>
            <td>服务类型</td>
            <td>上传时间</td>
            <td>修改</td>
        </tr>
        {% for i in data %}
            <tr>
                <td>{{ i.id }}</td>
                <td>{{ i.username }}</td>
                <td><a href="../static/upload/{{ i.headImg }}" target="_blank">{{ i.headImg }}</a></td>
                <td>{{ i.service_type }}</td>
                <td>{{ i.updatetime|date:"Y-m-d H:i:s" }}</td>
                <td><a href="/admin/app01/user/{{ i.id }}/change/" target="_blank"><input type="submit" class="btn btn-primary" value="修改"/></a>
                </td>
            </tr>
        {% endfor %}
    </table>

</div>
<!--4.把jQuery 引入-->
<script src="/static/js/jquery-1.10.2.min.js"></script>
<!--5.把bootstrap 核心脚本文件（压缩版）引入-->
<script src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript">
    var username = document.getElementById('user_name');
    var usernames = username.innerHTML;
    var id_username = document.getElementById('id_用户');
    console.log(id_username);
    //id_username.setAttribute('disabled','');
    id_username.setAttribute('value', usernames);
    $(document).ready(function () {
        $("p:eq(0)").hide();
        $(".user").val(usernames);
        $(".user").parent().hide();
    });

</script>
</body>
</html>